package com.example.javatwo.mapper.cg.yt;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.mybatis.spring.annotation.MapperScan;

import com.example.javatwo.pojo.cg.yt.DsAssignBuy;
import com.example.javatwo.pojo.cg.yt.DsAssignBuyMain;
import com.example.javatwo.pojo.cg.yt.DsAssignFee;

@MapperScan
public interface CgftMapper {
	// 查询全表
		@Select("select * from DsAssignBuyMain where del='否' order by billNo desc LIMIT ${sum},1 ")
		public List<DsAssignBuyMain> list(@Param("sum") int sum);
		
		// 更具主表id查询降表
		@Select("select * from DsAssignBuy where billno='${billno}'")
		public List<DsAssignBuy> list2(@Param("billno") String billno);
		
		// 更具主表id查询降表
		@Select("select * from DsAssignFee where billno='${billno}'")
		public List<DsAssignFee> list3(@Param("billno") String billno);

		@Select("select sum(1) from DsAssignBuyMain")
		public int sum();
		
		public void add(@Param("by") DsAssignBuyMain assignBuyMain);

		public void addInfo(@Param("by")DsAssignBuyMain assignBuyMain);
		
		public void update(@Param("by")DsAssignBuyMain assignBuyMain);
		
		public void deleteInfo(@Param("billNo")String billNo);
		
		@Update("update dsassignBuyMain set del = '是' where billNo = '${billNo}'")
		public void delete(@Param("billNo")String billNo);
		   
		@Select("select ynAudit from dsassignbuymain where billNo='${billNo}'")
		public String findSet1(@Param("billNo")String billNo);
		
		@Update("update dsassignbuymain set ynAudit = '${ynAudit}' where billNo = '${billNo}'")
		public void setYnAudit(@Param("billNo")String billNo,@Param("ynAudit")String andit);
}
